<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>拼车系统</title>
    <link rel="stylesheet" href="<?php echo base_url('bootstrap/css/bootstrap.css'); ?>">
    <link rel="stylesheet" href="<?php echo base_url('bootstrap/css/bootstrap-theme.css'); ?>">
    <link rel="stylesheet" href="<?php echo base_url('bootstrap/css/bootstrap-datetimepicker.css'); ?>">
    <link rel="stylesheet" href="<?php echo base_url('css/style.css') ?>">
</head>
<body>
<nav class="navbar navbar-inverse" id="navbar-top">
    <div id="div-top">
    <div class="navbar-header">
        <a class="navbar-brand navbar-h" href="<?php echo site_url('/info') ?>">
            <img src="<?php echo base_url('image/logo.png'); ?>">
        </a>
    </div>
    <div class="collapse navbar-collapse">
        <ul class='nav nav-pills nav-self'>
            <?php
            $signup=site_url('user/signup');
            $signin=site_url('user/signin');
            $create=site_url('info/create');
            $manage=site_url('info/manage');
            $signout=site_url('user/signout');
            $name=$this->session->userdata('username');
            if(!$this->session->userdata('login'))
            {
                echo "<li><a href='$signup'>注册</a></li>".
                    "<li><a href='$signin'>登录</a></li>";
            }
            else
            {
                echo "<li><span class='navbar-text navbar-right'>欢迎 $name</span></li>".
                    "<li><a href='#'>用户中心</a></li>".
                    "<li><a href='$manage'>订单管理</a></li>".
                    "<li><a href='$signout'>注销</a></li>";
            }
            ?>
        </ul>
    </div>
    </div>
</nav>
<nav class="navbar navbar-default">
    <div class="container">
    <form id="createinfo" class="navbar-form navbar-left">
        <div class="form-group">
            <label class="control-label" for="begin">起点</label>
            <select class="form-control input-sm" name="begin" id="begin">
                <option value="0">淮工</option>
                <option value="1">月季花园</option>
                <option value="2">大运河桥</option>
                <option value="3">联盛广场</option>
                <option value="4">淮海广场</option>
            </select>
        </div>
        <div class="form-group">
            <label class="control-label" for="end">终点</label>
            <select class="form-control input-sm" name="end" id="end">
                <option value="0">淮工</option>
                <option value="1">月季花园</option>
                <option value="2">大运河桥</option>
                <option value="3">联盛广场</option>
                <option value="4">淮海广场</option>
            </select>
        </div>
        <div class="form-group">
            <label for="time" class="control-label">时间</label>
            <input id="time" name="time" size="16" type="text" value="" readonly class="form-control form_datetime input-sm">
        </div>
        <div class="form-group">
            <label class="control-label" for="phone">电话</label>
            <input type="tel" class="form-control input-sm" id="phone" name="phone" placeholder="请输入联系电话">
        </div>
        <div class="form-group" id="div-maxnum">
            <label class="control-label" for="maxnum">载客数</label>
            <select class="form-control input-sm" name="maxnum" id="maxnum">
                <option value="1">1</option>
                <option value="2">2</option>
                <option value="3">3</option>
                <option value="4">4</option>
                <option value="5">5</option>
            </select>
        </div>
        <div class="form-group">
            <label class="radio-inline" id="lkey1">
                <input type="radio" name="key" id="key1" value="0"> 找乘客
            </label>
            <label class="radio-inline" id="lkey2">
                <input type="radio" name="key" id="key2" value="1"> 找车主
            </label>
        </div>
        <input id="create" type="button" class="btn btn-default" value="信息创建">
    </form>
    </div>
</nav>
<div id="info"></div>
<script src="<?php echo base_url('js/jquery-2.1.1.js'); ?>"></script>
<script src="<?php echo base_url('bootstrap/js/bootstrap.js'); ?>"></script>
<script src="<?php echo base_url('bootstrap/js/bootstrap-datetimepicker.js'); ?>"></script>
<script src="<?php echo base_url('bootstrap/js/locales/bootstrap-datetimepicker.zh-CN.js'); ?>"></script>
<script type="text/javascript">
    var d=new Date();
    var m= d.getMonth()+1;
    var s= d.getFullYear()+"-"+ m+"-"+ d.getDate()+" "+ d.getHours()+":"+ d.getMinutes();
    $(".form_datetime").datetimepicker({
        format: "yyyy-mm-dd hh:ii",
        autoclose: true,
        todayBtn: true,
        startDate: s,
        minuteStep: 10,
        language: "zh-CN"
    });
    $("#lkey1").click(function(){
        $("#div-maxnum").show();
    });
    $("#lkey2").click(function(){
        $("#div-maxnum").hide();
    });
    $("#create").click(function(){
        $.ajax({
            cache:true,
            type:'post',
            url:'<?php echo site_url('info/create'); ?>',
            data: $("#createinfo").serialize(),
            error:function(){},
            success:function(data){
                if(data!='0')
                {
                    $("#info").html(data);
                }
            }
        });
    });
</script>
</body>
</html>